//package com.pp.interceptor;
//
//import org.springframework.web.servlet.HandlerInterceptor;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//
///**
// * Created by Zhang on 2018/8/26.
// */
//public class Sessioninterceptor implements HandlerInterceptor {
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
///*    System.out.println(request.getRequestURI());
//    String base=request.getContextPath();
//        if (request.getRequestURI().equals(base+"/user/login")||request.getRequestURI().equals(base+"/user/main")){
//        return  true;
//    }*/
//        HttpSession session=request.getSession();
//          if (session.getAttribute("user")!=null){
//              return true;
//          }else{
//
//              response.sendRedirect(request.getContextPath()+"/admin");
//              return  false;
//          }
//
//
//    }
//}
